package org.nix.service;

import org.nix.dao.UserJpa;
import org.nix.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Create by zhangpe0312@qq.com on 2018/4/19.
 */
@Service
public class UserService {

    @Autowired
    private UserJpa userJpa;

    /**
     * 登陆服务
     * @param user
     * @return
     */
    public boolean login(User user){

       User temp = userJpa.findUserByName(user.getUserName());

       if (temp == null)
           return false;

       if (temp.getPassword().equals(user.getPassword()))
           return true;

        return false;
    }

}
